#pragma once

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

class FdSetting
{
public:
    static bool setNonBlock(int fd)
    {
        int flags = fcntl(fd, F_GETFL);
        if(flags == -1)
        {
            return false;
        }
        if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
        {
            return false;
        }
        return true;
    }
};